﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SharedGenomics.Core;

namespace SharedGenomics.Domain
{
    /// <summary>
    /// The reasons a SNP/individual was removed by filtering - these values are also output by the filter program and are defined in bfilter.h in the 
    /// C code
    /// </summary>
    public enum FilterReason
    {
        None = 0,
        LowGenotyping = 1,
        SnpMissingness = 2,
        MAF = 4,
        HardyWeinberg = 8,
        CategoricalFilter = 16
    }

    public static class FilterReasonExtensions
    {
        public static bool IsIndividualReason(this FilterReason reason)
        {
            return reason.In(FilterReason.LowGenotyping, FilterReason.CategoricalFilter);
        }

        public static bool IsSnpReason(this FilterReason reason)
        {
            return reason.In(FilterReason.MAF, FilterReason.HardyWeinberg, FilterReason.SnpMissingness);
        }
    }
}
